package com.im.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.im.app.mapper.LixianMapper;
import com.im.app.model.Lixian;
import com.im.app.service.LixianService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 快捷语(Lixian)表服务实现类
 *
 * @author makejava
 * @since 2023-03-20 14:21:46
 */
@Service
@Transactional(rollbackFor = Exception.class)
@Slf4j
public class LixianServiceImpl implements LixianService {

    @Resource
    private LixianMapper lixianMapper;
    @Override
    public List<Lixian> queryLixianList() {
        //分页
//        Page<Lixian> rowPage = new Page(1, 10);
//        Page<Lixian> LixianPage = LixianDao.selectPage(rowPage, new QueryWrapper<Lixian>().orderByDesc("create_time"));
        List<Lixian> lixianList = lixianMapper.selectList(new QueryWrapper<Lixian>().orderByDesc("create_time"));
        return lixianList;
    }

    @Override
    public Lixian findLixian(Integer id) {
        return lixianMapper.selectById(id);
    }

    @Override
    public int deleteLixian(Integer id) {
        return lixianMapper.deleteById(id);
    }

    @Override
    public int addLixian(Lixian lixian) {
        return lixianMapper.insert(lixian);
    }

    @Override
    public int updateLixian(Lixian lixian) {
        return lixianMapper.updateById(lixian);
    }


}

